import pandas as pd
import requests
# 将设备绑定工地
df = pd.read_excel('./config/data.xls',sheet_name='Sheet5', header=0)
values = df.values
print(len(values))
arr =[]
for v in values:
    arr.append(v[0])
print(arr)
for i in arr:
    url = "https://192.168.3.172:8097/api/deviceManage/device/setWorksite?worksiteId=21"

    #payload = "[\"16A1\"]"
    payload = f"[\"{i}\"]"
    print(payload)
    headers = {
        'Accept': 'application/json, text/plain, */*',
        'Accept-Language': 'zh-CN,zh;q=0.9',
        'Authorization': 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImEzNTg1MTljLTllNzEtNGFkOC04NzM1LTAyN2QzNDgwZjE2NCJ9.B9Ot7bFLzwPXZ68U6nNIeBSrozVIn_WTx1fNI9s38OsV4N00wT9N3i2Z0DfXECb8LzxGrau6n-6cLrn7irPj2A',
        'Connection': 'keep-alive',
        'Content-Type': 'application/json;charset=UTF-8',

    }



    response = requests.request("POST", url, headers=headers, data=payload,verify=False)

    print(response.text)




